﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script language="javascript" type="text/javascript" src="js/template.js"></script> 
    <script language="javascript" type="text/javascript">
        //bind specified js template - jst with data template - dt
        function LoadTemplateData(jst, dt, paramsToDt, processHandler)
        {
            Ajax.Callback(dt, 'jst=' + jst + '&' + paramsToDt, processHandler);
        }
        
        function DoBinding1(content)
        {
            //alert(content);
        
            var data = eval("(" + content + ")");
            
            var result = TrimPath.parseTemplate(data.jst).process(data);
            
            document.getElementById('result').innerHTML = result;
        }
    </script> 
</head>
<body onload="LoadTemplateData('JsTemplates/DemoTemplate', 'AjaxTemplates/DemoData', null, 'DoBinding1');">
    <form id="form1" runat="server">
    <div>
        <input type="button" value="Load Demo Data 2" onclick="LoadTemplateData('JsTemplates/DemoTemplate2', 'AjaxTemplates/DemoData2', null, 'DoBinding1');"/><br />
        <br />
    </div>
   <div id="result">
   </div> 
    </form>
</body>
</html>
